%% Experiment 1

im1 = imread('../images/circuit.tif');
figure(1)
imshow(im1)
phase_only(im1); 

%%
ima = imread('../images/sonar.bmp');   
figure(1);
colormap(gray);
imagesc(ima);
figure(2);
colormap(gray);
ima_out=random_phase(ima);

%%
ima = imread('../images/lena.bmp');   
figure(1);
% colormap(gray);
imagesc(ima);
figure(2);
% colormap(gray);
ima_out=random_magnitude(ima);

%% Experiment 2.1

ima = SimpleFiltering(ima,0,0.3);
imshow(mat2gray(ima))
%% Experiment 2.2
twoDimDFT(ima,15.1);

%% Experiment 2.3: Fourier Spectrum and Average Value
ima = imread('../images/ImageA.TIF');
dftIm = fft2(ima);
dftImg = log10(abs(fftshift(fft2(ima))));
imshow(mat2gray(dftImg));
dftIm(1,1)
avgVal = dftIm(1,1)/prod(size(ima))

%% Experiment 3: Compression and DCT
ima = imread('../images/circuit.tif');
[ima,imafft,mag_quant,phi_quant] = quant_fft(ima,10000,10,10000);

imshow(imafft)